//package net.jjjshop.admin.controller;
//
//import cn.hutool.core.collection.CollUtil;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import net.jjjshop.common.entity.lbt.UserExtract;
//import net.jjjshop.common.entity.lbt.UserExtractSearchRequest;
//import net.jjjshop.common.service.lbt.UserExtractService;
//import net.jjjshop.framework.common.api.ApiResult;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.HashMap;
//
//
//@Slf4j
//@RestController
//@RequestMapping("api/admin/finance/apply")
//@Api(tags = "财务 -- 提现申请")
//public class UserExtractController {
//
//    @Autowired
//    private UserExtractService userExtractService;
////    @Autowired
////    private ExcelService excelService;
//    /**
//     * 导出excel
//     */
//   // //@PreAuthorize("hasAuthority('admin:finance:apply:excel')")
//    @ApiOperation(value = "提现")
//    @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
//    public ApiResult<HashMap<String, String>> export(@Validated UserExtractSearchRequest request) {
//        String fileName = excelService.exportUserExtract(request);
//        HashMap<String, String> map = CollUtil.newHashMap();
//        map.put("fileName", fileName);
//        return RuntimeException(map);
//    }
//
//    /**
//     * 分页显示用户提现表
//     * @param request 搜索条件
//     * @param pageParamRequest 分页参数
//     */
//    //@PreAuthorize("hasAuthority('admin:finance:apply:list')")
//    @ApiOperation(value = "分页列表")
//    @RequestMapping(value = "/list", method = RequestMethod.GET)
//    public ApiResult<IPage<UserExtract>>  getList(@Validated UserExtractSearchRequest request, @Validated PageParamRequest pageParamRequest){
//        CommonPage<UserExtract> userExtractCommonPage = CommonPage.restPage(userExtractService.getList(request, pageParamRequest));
//        return RuntimeException(userExtractCommonPage);
//    }
//
//    /**
//     * 修改用户提现表
//     * @param id integer id
//     * @param userExtractRequest 修改参数
//     */
//    //@PreAuthorize("hasAuthority('admin:finance:apply:update')")
//    @ApiOperation(value = "修改")
//    @RequestMapping(value = "/update", method = RequestMethod.POST)
//    public ApiResult<String> update(@RequestParam Integer id, @Validated UserExtractRequest userExtractRequest){
//        if (userExtractService.updateExtract(id, userExtractRequest)) {
//            return RuntimeException();
//        } else {
//            return ApiResult.failed();
//        }
//    }
//
//    /**
//     * 提现统计
//     * @Param dateLimit 时间限制 today,yesterday,lately7,lately30,month,year,/yyyy-MM-dd hh:mm:ss,yyyy-MM-dd hh:mm:ss/
//     */
//    //@PreAuthorize("hasAuthority('admin:finance:apply:balance')")
//    @ApiOperation(value = "提现统计")
//    @RequestMapping(value = "/balance", method = RequestMethod.POST)
//    public ApiResult<BalanceResponse> balance(@RequestParam(value = "dateLimit", required = false,defaultValue = "")
//                                                 String dateLimit){
//        return RuntimeException(userExtractService.getBalance(dateLimit));
//    }
//
//    /**
//     * 提现审核
//     * @param id    提现id
//     * @param status    审核状态 -1 未通过 0 审核中 1 已提现
//     * @param backMessage   驳回原因
//     * @return 审核结果
//     */
//    //@PreAuthorize("hasAuthority('admin:finance:apply:apply')")
//    @ApiOperation(value = "提现申请审核")
//    @RequestMapping(value = "/apply", method = RequestMethod.POST)
//    public ApiResult<String> updateStatus(@RequestParam(value = "id") Integer id,
//                                             @RequestParam(value = "status",defaultValue = "审核状态 -1 未通过 0 审核中 1 已提现") Integer status,
//                                             @RequestParam(value = "backMessage",defaultValue = "驳回原因", required = false) String backMessage){
//        if(userExtractService.updateStatus(id, status, backMessage)){
//            return RuntimeException();
//        }else{
//            return ApiResult.failed();
//        }
//    }
//}
//
//
//
